package com.palmap.redis;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

/**
 * @author zhangxinju
 * @since 2020/5/8 9:53 上午
 */
@Component
@Slf4j
public class TaskConsumer implements MessageListener {

    @Override
    public void onMessage(Message message, byte[] bytes) {
        byte[] channel = message.getChannel();
        byte[] body = message.getBody();

        log.info("task channel :{}", new String(channel));
        log.info("task content: {}", new String(body));
    }
}
